package cn.edu.hstc.wm.ui.base;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import cn.edu.hstc.wm.widget.XListView;
import cn.edu.hstc.wm.widget.XListView.IXListViewListener;

import cn.edu.hstc.wm.R;

/**
 * Fragment 基类 ;考虑到兼容性,所以继承了SherlockFragment
 */
public class BaseListFragment extends BaseFragment implements IXListViewListener {

	public static final String TAG = BaseFragment.class.getName();

	LayoutInflater mInflater;
	View mView;
	XListView xListView;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		Log.v(TAG, "onCreateView");
		mInflater = inflater;
		mView = inflater.inflate(R.layout.base_list_fragment_layout, null);
		xListView = (XListView) mView.findViewById(R.id.xlistview_show_data);
		// initListView();
		xListView.setPullLoadEnable(true);
		xListView.setPullRefreshEnable(true);
		return super.onCreateView(inflater, container, savedInstanceState);
	}

	@Override
	public void onRefresh() {

	}

	@Override
	public void onLoadMore() {

	}

	public void onLoad() {
		xListView.stopRefresh();
		xListView.stopLoadMore();
		xListView.setRefreshTime(new SimpleDateFormat("HH:mm:ss") // 更新时间设置
				.format(new Date(System.currentTimeMillis())) + "");
	}

}
